local addonName,ns = ...
local L = ns.L
local DB = ns.PlateColorDB
local SetLoaded--设置加载一次
ns.event("PLAYER_ENTERING_WORLD", function()
if SetLoaded then return end
SetLoaded = true
--检查LibSharedMedia插入所有LSM已注册的材质
if LibStub and LibStub("LibSharedMedia-3.0",true) then
	local LSMtextures = LibStub("LibSharedMedia-3.0"):HashTable("statusbar")
	for key, value in pairs(LSMtextures) do
		ns.HpTextures[key] = value
	end
end
ns.UseHpTextures = {}
for k in pairs(ns.HpTextures) do
    table.insert(ns.UseHpTextures, k)
end
table.sort(ns.UseHpTextures)--排序材质表格

--分页1滚动框架
local ConFramescrollFrame1 = CreateFrame("ScrollFrame", nil, ns.tabframe1, "UIPanelScrollFrameTemplate")
ConFramescrollFrame1:SetPoint("TOPLEFT", ns.tabframe1, "TOPLEFT", 4, -5)
ConFramescrollFrame1:SetPoint("BOTTOMRIGHT", ns.tabframe1, "BOTTOMRIGHT", -30, 5)

--分页1滚动内容
local ConFrame1 = CreateFrame("Frame", nil, ConFramescrollFrame1)
ConFrame1:SetSize(670,480)
ConFramescrollFrame1:SetScrollChild(ConFrame1)
ns.Y[1] = 0	--设置起始位置


ns.DisableCVar = ns.AddSetClickB(ConFrame1,1,L["禁用所有调节CVar选项"],L["禁用所有调节CVar选项鼠标提示"],"disableCVarSet")
ns.DisableCVar.check:HookScript("OnClick", function (self)
	ns.forbidSetCVars()
end)
local showid = ns.AddSetClickB(ConFrame1,1,L["鼠标提示显示ID"],L["鼠标提示显示ID鼠标提示"],"showid")

local TiText1 = ns.AddSetTiText(ConFrame1,1,L["样式"])
local hpTexture = ns.AddSetDropdTexture(ConFrame1,1,L["血条材质选择"],L["血条材质选择鼠标提示"],"hpTexture",ns.HpTextures)
local castold = ns.AddSetClickB(ConFrame1,1,L["旧版施法条"],L["旧版施法条鼠标提示"],"castold")
local castTexture = ns.AddSetDropdTexture(ConFrame1,1,L["施法条材质选择"],L["施法条材质选择"],"CastBarTexture",ns.HpTextures)

local TiText2 = ns.AddSetTiText(ConFrame1,1,L["名字"])
local showAllName = ns.AddSetClickB(ConFrame1,1,L["总是显示名字"],L["总是显示名字鼠标提示"],"showAllName")
local whiteName = ns.AddSetClickB(ConFrame1,1,L["白色敌方名字"],L["白色敌方名字鼠标提示"],"whiteName")
local enemyNameOUTLINE = ns.AddSetClickB(ConFrame1,1,L["敌方名字描边"],L["敌方名字描边鼠标提示"],"enemyNameOUTLINE")
local enemyNameScale = ns.AddSetSlider(ConFrame1,1,L["敌方名字大小"],L["敌方名字大小鼠标提示"],5,30,1,"%d","enemyNameScale",1)
local friendNameOUTLINE = ns.AddSetClickB(ConFrame1,1,L["友方名字描边"],L["友方名字描边鼠标提示"],"friendNameOUTLINE")
local friendNameScale = ns.AddSetSlider(ConFrame1,1,L["友方名字大小"],L["友方名字大小鼠标提示"],5,30,1,"%d","friendNameScale",1)
local NPCNameOUTLINE = ns.AddSetClickB(ConFrame1,1,L["NPC名字描边"],L["NPC名字描边鼠标提示"],"NPCNameOUTLINE")
local NPCNameScale = ns.AddSetSlider(ConFrame1,1,L["NPC名字大小"],L["NPC名字大小鼠标提示"],5,30,1,"%d","NPCNameScale",1)
local NPCwhiteFunText = ns.AddSetClickB(ConFrame1,1,L["白色NPC功能文本"],L["白色NPC功能文本鼠标提示"],"NPCwhiteFunText")

local TiText3 = ns.AddSetTiText(ConFrame1,1,L["友方血条"])
local friendnpXY = ns.AddSetClickB(ConFrame1,1,L["仅显名字模式"],L["仅显名字模式鼠标提示"],"OnlyName","nameplateShowOnlyNames","friendnpX","friendnpY")
local friendnpX = ns.AddSetSlider(ConFrame1,1,L["友方血条长度"],L["友方血条长度鼠标提示"],24,154,1,"%d","friendnpX",2,"friendnpY")
local friendnpY = ns.AddSetSlider(ConFrame1,1,L["友方姓名版高度"],L["友方姓名版高度鼠标提示"],-35,64,1,"%d","friendnpY",3,"friendnpX")

local TiText4 = ns.AddSetTiText(ConFrame1,1,L["指示器"])
local nameQuest = ns.AddSetClickB(ConFrame1,1,L["显示任务标志"],L["显示任务标志鼠标提示"],"nameQuest")
local arrow = ns.AddSetClickB(ConFrame1,1,L["右侧箭头指示器"],L["右侧箭头指示器鼠标提示"],"arrow")
local focusTexture = ns.AddSetClickB(ConFrame1,1,L["焦点斜线材质"],L["焦点斜线材质鼠标提示"],"focusTexture")
local mGlow = ns.AddSetClickB(ConFrame1,1,L["鼠标指向边框变色"],L["鼠标指向边框变色鼠标提示"],"mGlow")
local levelText = ns.AddSetClickB(ConFrame1,1,L["等级文本"],L["等级文本鼠标提示"],"levelText")
local absorbText = ns.AddSetClickB(ConFrame1,1,L["吸收盾数值"],L["吸收盾数值鼠标提示"],"absorbText")
local classIcon = ns.AddSetClickB(ConFrame1,1,L["显示玩家职业图标"],L["显示玩家职业图标鼠标提示"],"classIcon")
local hideFlags = ns.AddSetClickB(ConFrame1,1,L["隐藏精英标志"],L["隐藏精英标志鼠标提示"],"hideFlags")
local petScale = ns.AddSetClickB(ConFrame1,1,L["缩小宠物姓名版"],L["缩小宠物姓名版鼠标提示"],"petScale")

local TiText5 = ns.AddSetTiText(ConFrame1,1,L["施法"])
local castTime = ns.AddSetClickB(ConFrame1,1,L["施法条施法时间"],L["施法条施法时间鼠标提示"],"castTime")
local castBarHeight = ns.AddSetSlider(ConFrame1,1,L["施法条高度"],L["施法条高度鼠标提示"],5,30,1,"%d","castBarHeight",1)
local castIntName = ns.AddSetClickB(ConFrame1,1,L["施法条打断来源"],L["施法条打断来源鼠标提示"],"castIntName")
local castTarget = ns.AddSetClickB(ConFrame1,1,L["施法预警"],L["施法预警鼠标提示"],"castTarget")
local targetIsyou = ns.AddSetClickB(ConFrame1,1,L["被选中预警"],L["被选中预警鼠标提示"],"targetIsyou")
local castTargetSize = ns.AddSetSlider(ConFrame1,1,L["施法目标名字大小"],L["施法目标名字大小"],10,40,1,"%d","castTargetSize")

local TiText6 = ns.AddSetTiText(ConFrame1,1,L["生命值"])
local hpValue = ns.AddSetClickB(ConFrame1,1,L["生命值数值"],L["生命值数值鼠标提示"],"hpValue")
local hpPercent = ns.AddSetClickB(ConFrame1,1,L["生命值百分比"],L["生命值百分比鼠标提示"],"hpPercent")
local Ftable = {{"|cffB2B2B2 || |r","|cffB2B2B2 || |r"},{"|cffB2B2B2 / |r","|cffB2B2B2 / |r"},{"|cffB2B2B2 - |r","|cffB2B2B2 - |r"},{" || "," || "},{" / "," / "},{" - "," - "},
{"|cffB2B2B2|||r","|cffB2B2B2|||r"},{"|cffB2B2B2/|r","|cffB2B2B2/|r"},{"|cffB2B2B2-|r","|cffB2B2B2-|r"},{"||","||"},{"/","/"},{"-","-"}}
local Delimiter = ns.AddSetDropdM(ConFrame1,1,L["分隔符"],L["分隔符鼠标提示"],Ftable,"Delimiter")
local hpUnits = ns.AddSetDropdM(ConFrame1,1,L["生命值单位"],L["生命值单位鼠标提示"],{{L["单位默认"],1},{L["单位中文"],2},{L["单位英文"],3}},"hpUnits")
local hpScale = ns.AddSetSlider(ConFrame1,1,L["生命值缩放"],L["生命值缩放鼠标提示"],0.5,2,0.01,"%.2f","hpScale")
local hpPoint = ns.AddSetDropdM(ConFrame1,1,L["生命值位置"],L["生命值位置鼠标提示"],{{L["左"],1},{L["中"],2},{L["右"],3}},"hpPoint")

local TiText7 = ns.AddSetTiText(ConFrame1,1,L["其他"])
local npWidht = ns.AddSetSlider(ConFrame1,1,L["姓名版可见范围"],L["姓名版可见范围鼠标提示"],10,60,1,"%d","npRange","nameplateMaxDistance")
local npWidht = ns.AddSetSlider(ConFrame1,1,L["姓名版宽度"],L["姓名版宽度鼠标提示"],0.5,3,0.1,"%.1f","npWidht","NamePlateHorizontalScale")
local npHeight = ns.AddSetSlider(ConFrame1,1,L["姓名版高度"],L["姓名版高度鼠标提示"],0.1,10,0.1,"%.1f","npHeight","NamePlateVerticalScale")
local npScale = ns.AddSetSlider(ConFrame1,1,L["姓名版全局缩放"],L["姓名版全局缩放鼠标提示"],0.5,2,0.1,"%.1f","npScale","nameplateGlobalScale")
local npTargetScale = ns.AddSetSlider(ConFrame1,1,L["当前目标缩放"],L["当前目标缩放鼠标提示"],0.1,2,0.1,"%.1f","npTargetScale","nameplateSelectedScale")
local npNoTargetAlpha = ns.AddSetSlider(ConFrame1,1,L["非当前目标透明度"],L["非当前目标透明度鼠标提示"],0,1,0.1,"%.1f","npNoTargetAlpha","nameplateMaxAlpha","nameplateMinAlpha")
local selfshown = ns.AddSetClickB(ConFrame1,1,L["始终显示个人资源"],L["始终显示个人资源鼠标提示"],"selfshown","NameplatePersonalShowAlways")
local selfMpScale = ns.AddSetSlider(ConFrame1,1,L["个人资源缩放"],L["个人资源缩放鼠标提示"],0.1,2,0.1,"%.1f","selfMpScale","nameplateSelfScale")
local selfMpText = ns.AddSetClickB(ConFrame1,1,L["个人资源能量值"],L["个人资源能量值鼠标提示"],"selfMpText")
local selfMpTextScale = ns.AddSetSlider(ConFrame1,1,L["个人资源能量值大小"],L["个人资源能量值大小鼠标提示"],0.5,2,0.1,"%.1f","selfMpTextScale")
local npOverlapV = ns.AddSetSlider(ConFrame1,1,L["垂直间距"],L["垂直间距鼠标提示"],0.1,2,0.1,"%.1f","npOverlapV","nameplateOverlapV")
local npOverlapH = ns.AddSetSlider(ConFrame1,1,L["水平间距"],L["水平间距鼠标提示"],0.1,2,0.1,"%.1f","npOverlapH","nameplateOverlapH")
local npOccludedAlpha = ns.AddSetSlider(ConFrame1,1,L["障碍物透明度"],L["障碍物透明度鼠标提示"],0,1,0.1,"%.1f","npOccludedAlpha","nameplateOccludedAlphaMult")

end)